/**
 * @author 0283000115
 * @date 2018年3月3日-下午3:06:17
 */
package com.zte.claa.inficombo.csa.app.dao.mysql.impl;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.zte.claa.inficombo.csa.app.model.dev.DevBase;
import com.zte.claa.inficombo.csa.app.model.dev.DevPagePara;
import com.zte.claa.inficombo.csa.app.model.dev.SensorDevEuiPV;
import com.zte.claa.inficombo.csa.app.model.redis.ProjectDev;

/**
 * @author 0283000115
 *
 */

@Repository
public interface DevBaseMapper {
	/**
	 * 分页查询dev列表
	 * 
	 * @param pp
	 * @return
	 * @throws Exception
	 */
	public List<DevBase> queryDevs(@Param("pp") DevPagePara pp) throws Exception;
	
	/**
	 * 分页查询指定appeui对应的dev列表
	 * 
	 * @param pp, @param appeui
	 * @return
	 * @throws Exception
	 */
	public List<DevBase> queryDevsByAppeui(@Param("pp") DevPagePara pp, @Param("appeui") String appeui) throws Exception;
	
	/**
	 * 查询指定deveui对应的dev
	 * 
	 * @param deveui
	 * @return
	 * @throws Exception
	 */
	public DevBase queryDevByEui(@Param("deveui") String deveui) throws Exception;
	
	/**
	 * 查询指定deveui对应的dev完整信息
	 * 
	 * @param deveui
	 * @return
	 * @throws Exception
	 */
	public ProjectDev queryProjectDevByEui(@Param("deveui") String deveui) throws Exception;
	
	/**
	 * 分页查询dev总数. 
	 * 
	 * @return
	 * @throws Exception
	 */
	public int queryAllDevTotalNum() throws Exception;
	
	/**
	 * 修改设备位置
	 * 
	 * @param deveui
	 * @param devaddr
	 * @return
	 * @throws Exception
	 */
	public int updateDevAddress(@Param("deveui") String deveui, @Param("devaddr") String devaddr) throws Exception;
	
	/**
	 * 修改设备坐标
	 * 
	 * @param deveui
	 * @param devaddr
	 * @return
	 * @throws Exception
	 */
	public int updateDevCoordinate(@Param("deveui") String deveui, @Param("gpslat") double gpslat, 
			                       @Param("gpslng") double gpslng, @Param("gpsalt") int gpsalt) throws Exception;

	/**
	 * 分页查询SensorDevEuiPV列表
	 * 注：SensorDevEuiPV 暂为华测GNSS设备定义，后续统一处理（从sensor和DTU(SSP/GSP）关联表查询）。
	 * 
	 * @param pp
	 * @return
	 * @throws Exception
	 */
	public List<SensorDevEuiPV> querySensorDevEuiPVs(@Param("pp") DevPagePara pp) throws Exception;
	
	/**
	 * 查询指定sensorid对应的SensorDevEuiPV
	 * 
	 * @param deveui
	 * @return
	 * @throws Exception
	 */
	public SensorDevEuiPV querySensorDevEuiPV(@Param("sensorid") String sensorid) throws Exception;	
	
	/**
	 * 插入SensorDevEuiPV
	 * 
	 * @param pp
	 * @return
	 * @throws Exception
	 */
	public void addSensorDevEuiPV(@Param("pv") SensorDevEuiPV pv) throws Exception;
	
	/**
	 * 删除SensorDevEuiPV
	 * 
	 * @param pp
	 * @return
	 * @throws Exception
	 */
	public int remvoeSensorDevEuiPV(@Param("sensorid") String sensorid) throws Exception;
	
	/**
	 * 删除DTU关联的全部SensorDevEuiPV
	 * 
	 * @param pp
	 * @return
	 * @throws Exception
	 */
	public int remvoeSensorDevEuiPVByDev(@Param("deveui") String deveui) throws Exception;
		
}
